package com.copa.service;

import com.copa.constant.MusicType;
import com.copa.service.impl.KugouServiceImpl;
import com.copa.service.impl.NeteaseCloudServiceImpl;
import com.copa.service.impl.QQMusicServiceImpl;

import java.util.Objects;

/**
 * @author copa
 * @createDate 2022-02-17 22:10
 * @function
 */
public class MusicFactory {

    public static MusicService getMusicService(String type) {
        if (Objects.equals(MusicType.QQ.getPlatform(), type.toUpperCase())) {
            return new QQMusicServiceImpl();
        }
        if (Objects.equals(MusicType.NETEASECLOUD.getPlatform(), type)) {
            return new NeteaseCloudServiceImpl();
        }
        if (Objects.equals(MusicType.KUGOU.getPlatform(), type)) {
            return new KugouServiceImpl();
        }
        throw new RuntimeException("不存在的音乐平台类型~");
    }
}
